package com.qnzw.zjmy.home.ui.adapter;

import android.content.Context;

import com.qnzw.zjmy.R;
import com.qnzw.zjmy.home.ui.enums.ToExamineEnum;
import com.qnzw.zjmy.refresh.baseadapter.CommonAdapter;
import com.qnzw.zjmy.refresh.baseadapter.ViewHolder;
import com.qnzw.zjmy.home.ui.model.WithdrawalRecord;

import java.util.List;

public class WithdrawalRecordAdapter extends CommonAdapter<WithdrawalRecord> {
    public WithdrawalRecordAdapter(Context context, List<WithdrawalRecord> data, int layoutItemId) {
        super(context, layoutItemId, data);
    }

    @Override
    protected void convert(ViewHolder holder, WithdrawalRecord withdrawalRecord, int position) {
        Integer status = Integer.parseInt(withdrawalRecord.getWrStatus());
        if (ToExamineEnum.TO_EXAMINE_GOLD_COINS.getValue().equals(status)) {
            holder.setText(R.id.tv_title, "审核中");
            holder.setTextColor(R.id.tv_title, mContext.getResources().getColor(R.color.home));
            holder.setTextColor(R.id.tv_content, mContext.getResources().getColor(R.color.home));
        }
        if (ToExamineEnum.TO_EXAMINE_RED_ENVELOPE.getValue().equals(status)) {
            holder.setText(R.id.tv_title, "通过");
            holder.setTextColor(R.id.tv_title, mContext.getResources().getColor(R.color.teal_700));
            holder.setTextColor(R.id.tv_content, mContext.getResources().getColor(R.color.teal_700));
        }
        if (ToExamineEnum.TO_EXAMINE_FAIL.getValue().equals(status)) {
            holder.setText(R.id.tv_title, "拒绝（请联系客服）"+withdrawalRecord.getWrMark());
            holder.setTextColor(R.id.tv_title, mContext.getResources().getColor(R.color.orange));
            holder.setTextColor(R.id.tv_content, mContext.getResources().getColor(R.color.orange));

        }
        holder.setText(R.id.tv_order_id, withdrawalRecord.getWrOrderId());
        Double money = Double.parseDouble(withdrawalRecord.getWrMoney()) / 10000;
        holder.setText(R.id.tv_content, money + "元");
        holder.setText(R.id.tv_time, withdrawalRecord.getCreateTime());
    }
}
